<?php

require_once("application/user/User.php");
require_once("application/game/Game.php");

/**
 * 
 * @param $id
 * @param $firstname
 * @param $lastname
 * @param $profilePicSmallUrl
 * @param $profilePicBigUrl
 * @param $wiiCode
 * @param $friendCodeGameMap
 * @param $facebookFriend
 */
class Friend extends User{
	
	private $friendCodeGameMap;
	private $facebookFriend;
	
	public function Friend($id, $firstname, $lastname, $profilePicSmallUrl,
		$profilePicBigUrl, $wiiCode, $location, $storeLocation, array $friendCodeGameMap, $facebookFriend){
	
		// like super()
		parent::User($id, $firstname, $lastname, $profilePicSmallUrl, 
			$profilePicBigUrl, $wiiCode, $location, $storeLocation);

		/*
		 * array(array(
		 *  game_id => value,
		 *  friend_code => value)
		 *  ....)
		 */
		$this->friendCodeGameMap = $friendCodeGameMap;
		$this->facebookFriend = $facebookFriend;
	}
		
	public function getFriendCode(){
		return $this->friendCodeGameMap['friendCode'];
	}
	
	public function getIsFacebookFriend(){
		return $this->facebookFriend;
	}
	
	public function getFriendCodeGameMapString(){

//		print_r($this->friendCodeGameMap);
//		return $this->friendCodeGameMap;	

		$fcgm = array();
		
		foreach($this->friendCodeGameMap as $item){
			array_push($fcgm, array("game" => $item['game'],
									"friendCode" => $item['friend_code']));
		}
		
		return $fcgm; 
	}
}
?>
